package com.rysm.wjsm.demo2;

public class MyRunnable implements Runnable {
    private int ticket = 100;
    @Override
    public void run() {
            while (true){
                synchronized (MyRunnable.class){
                    if (ticket <= 10){
                        break;
                    }else {
                        System.out.println(Thread.currentThread().getName() + "送出第" + --ticket + "份礼物");
                    }
            }
        }

    }
}
